//
//  HomeApi.swift
//  LocaLink
//
//  Created by Icy on 2017/3/25.
//  Copyright © 2017年 Icy. All rights reserved.
//

import Foundation

import Foundation
import Alamofire
import NetWorkCore
import ModelProtocol

/**
 快速补货路由
 */
public enum HomeApi{
    /**
     获取全部小区
     */
    case GetAllCommunities(userName:String,token:String)
    ///根据经纬度，获取小区集合
    case GetCommunitiesByLatLng(userName:String,token:String,lat:String,lng:String,raidus:String,name:String)
    
}
extension HomeApi: TargetType {
    
    //设置请求路径
    public var path: String {
        switch self {
        case .GetAllCommunities:
            return "http://101.200.203.219:921/api/v1/Communities/GetAllCommunities"
        case .GetCommunitiesByLatLng:
            return "http://101.200.203.219:921/api/v1/Communities/GetCommunitiesByLatLng"
        }
    }
    
    //设置请求方式 get post等
    public var method: HTTPMethod {
        switch self {
        default :
            return .get
            
        }
    }
    /// 设置请求参数
    public var parameters: Parameters? {
        switch self {
        case let .GetAllCommunities(userName,token):
            return ["userName":userName,"token":token]
        case let .GetCommunitiesByLatLng(userName,token,lat,lng,raidus,name):
            return ["userName":userName,"token":token,"lat":lat,"lng":lng,"raidus":raidus,"name":name]
        default :
            return nil
        }
    }
    
}
